<template>
  <el-dialog
    :title="title"
    :visible.sync="visible"
    top="50px"
    width="650px"
  >
    <div :class="['dialog-container',  dialogType === '生成' && 'create-qrcode']">
      <div class="download-top" v-if="dialogType==='下载'">{{ $t('product.component.qrcodeDialog.selectTip', { count: qrcodeData.length }) }}</div>

      <div class="content">
        <el-tabs v-model="activeName" style="height:100%;display: flex;flex-direction: column;">
          <el-tab-pane :label="$t('product.component.qrcodeDialog.qrcode')" name="qrCode" style="height:100%;"></el-tab-pane>
          <el-tab-pane v-if="isOpenMiniProgramCode" :label="$t('product.component.qrcodeDialog.miniProgramCode')" name="miniProgramCode" style="height:100%;"></el-tab-pane>
        </el-tabs>

        <h4>{{dialogType==='预览'?$t('common.base.preview'):$t('product.component.qrcodeDialog.title1')}}</h4>

        <div class="qrcode-wrapper" :style="downloadStyle">
          <div class="qrcode-left">
            <p class="qrcode-tip">{{ $t('product.component.qrcodeDialog.text5') }}</p>
            <div class="qrcode-content" ref="qrcodeContent">
              <p class="qrcode-item com-item" v-if="showCompanyName">{{initData.nickName}}</p>
              <div class="code-container qrcode-item" v-show="activeName=='qrCode'">
                <div ref="qrCodeUrl" id="qrCodeUrl"></div>
              </div>
              <div class="code-container qrcode-item" v-show="activeName=='miniProgramCode'">
                <img v-if="dialogType==='生成'" :src="miniProgramDefaultImg" class="miniProgramCodeImg" alt="">
                <img v-if="dialogType==='预览'||dialogType==='下载'" :src="miniProgramImg" class="miniProgramCodeImg" alt="">
              </div>
              <p class="qrcode-item">{{getDisplayName('qrcodeId')}}</p>
              <p class="qrcode-item qrcode-item-line" v-if="showLine"></p>
              <p class="qrcode-item" :class="itemClass(item)" v-for="item in checkList" :key="item">
								<template v-if="item === 'qualityInfo'">
									<p class="qrcode-item qrcode-item-quality">{{ $t('common.form.preview.qualityField.label3') }}：{{ getValue(item, 'qualityStatus') }}</p>
									<p class="qrcode-item qrcode-item-quality">{{ $t('common.form.preview.qualityField.label1') }}：{{ getValue(item, 'qualityStartTime') }}</p>
									<p class="qrcode-item qrcode-item-quality">{{ $t('common.form.preview.qualityField.label2') }}：{{ getValue(item, 'qualityEndTime') }}</p>
								</template>
								<template v-else>
									{{ getDisplayName(item) }}：
									{{ getValue(item) }}
								</template>
              </p>
            </div>
          </div>

          <div class="qrcode-right">
            <h5>
              {{ $t('product.component.qrcodeDialog.title2') }}({{checkList.length}}/5)
              <el-tooltip effect='dark' :content="$t('product.component.qrcodeDialog.tip1')" placement="top">
                <i class="iconfont icon-fdn-info" style="font-size:13px;"></i>
              </el-tooltip>
            </h5>
            <el-checkbox-group class="field-list" @change="checkChange" v-model="checkList">
              <el-checkbox v-for="item in fieldList" :key="item.fieldName" :label="item.fieldName" :disabled='item.disabled'>{{item.displayName}}</el-checkbox>
            </el-checkbox-group>
          </div>
          <div ref="bridge" style="display:none;"></div>
        </div>
        <div class="qrcode-bottom" v-if="dialogType==='生成'">
          <h4>{{$t('product.component.qrcodeDialog.text1')}}</h4>
          <div class="qrcode-create-num">
            <span>{{$t('product.component.qrcodeDialog.text2')}}：</span>
            <el-input v-model="createNum" :max="margin" min='0' type="number"></el-input>
            <span>{{$t('product.component.qrcodeDialog.text3')}}：</span>
            <span class="qrcode-margin">{{margin}}</span>
          </div>
          <!-- <p class="qrcode-text">打印二维码一般支持两种形式，批量导入编号由<span>打印软件</span>生成二维码，或者是直接<span>批量打印图片</span>，请选择一种方式下载</p> -->
        </div>
      </div>
      <div class="stepper" :style="downloadStyle" v-if="dialogType==='生成'">
        <div>1</div>
        <p></p>
        <div>2</div>
      </div>
    </div>

    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false" v-if="dialogType!=='生成'">{{ $t('common.base.cancel') }}</el-button>
      <el-button type="danger" :disabled='pending' @click="unbindCode" v-if="dialogType==='预览' && alreadyBind && fromProduct && canProductCodeProduct">{{$t('product.component.qrcodeDialog.btn1')}}</el-button>
      <el-button type="primary" :disabled='pending || qrcodeData.available==0' @click="download" v-if="dialogType==='预览' && canProductCodeDownload">{{$t('product.component.qrcodeDialog.btn2')}}</el-button>
      <el-button @click="createCode()" :disabled='pending' v-if="dialogType==='生成'" v-track="$track.formatParams('QRCODE_ONLY_CREATE', null, 'CREATE_QRCODE_BTN')">{{$t('product.component.qrcodeDialog.btn3')}}</el-button>
      <el-button @click="createCode(downloadCode)" :disabled='pending' v-if="dialogType==='生成' && canProductCodeDownload" v-track="$track.formatParams('QRCODE_CREATE_AND_DOWNLOAD_URL', null, 'CREATE_QRCODE_BTN')">{{$t('product.component.qrcodeDialog.btn4')}}</el-button>
      <el-button type="primary" :disabled='pending' @click="createCode(downloadImg)" v-if="dialogType==='生成' && canProductCodeDownload" v-track="$track.formatParams('QRCODE_CREATE_AND_DOWNLOAD_IMG', null, 'CREATE_QRCODE_BTN')">{{$t('product.component.qrcodeDialog.btn5')}}</el-button>
      <el-button @click="createDownload('code')" :disabled='pending' v-if="dialogType==='下载' && canProductCodeDownload">{{$t('product.component.qrcodeDialog.btn6')}}</el-button>
      <el-button type="primary" :disabled='pending' @click="createDownload('img')" v-if="dialogType==='下载' && canProductCodeDownload">{{$t('product.component.qrcodeDialog.btn7')}}</el-button>
    </span>

    <unbind-dialog ref="unbindDialog" @unbindSuc='unbindSuc' :from-product='fromProduct' :product-id='qrcodeData.productId'></unbind-dialog>
  </el-dialog>
</template>

<script>
import * as productQrcode from '@src/api/productQrcode';
import { getProductDetail } from '@src/api/ProductApi';
import QRCode from 'qrcodejs2';
import {wechatGetAuthInfo} from '@src/api/DoMyself.js';
import { queryAppletQrCode, createAppletQrCode, appletQrcodeDownloadOne } from '@src/api/CustomerApi'
import UnbindDialog from './unbindDialog';
import VersionMixin from "@src/mixins/versionMixin/index.ts";
import { formatFormFieldItem } from '@src/filter/form';
import { getOssUrl } from '@src/util/assets'
import { formatDate, useFormTimezone } from 'pub-bbx-utils';

const { disposeFormItemViewTime } = useFormTimezone();
const logoImg = getOssUrl('/productV2/logo.png')

export default {
  name:'qrcode-dialog',
  mixins: [VersionMixin],
  data(){
    return{
      visible:false,
      checkList:[],
      fieldList:[
        {displayName:this.$t('product.component.qrcodeDialog.companyLogo'), fieldName:'companyLogo'},
        {displayName:this.$t('product.component.qrcodeDialog.companyName'), fieldName:'companyName'}
      ],
      filterFieldsNameMap: [],
      allFieldsNameMap: [],
      isFirst: true,
      createNum:'',
      margin:0,
      pending:false,
      activeName:'qrCode',
      isOpenMiniProgramCode:false,
      miniProgramDefaultImg:'', // 生成的时候展示
      miniProgramImg:'', // 预览的时候展示
      appletCodeId:'', // 小程序二维码id
      productFieldMap: {}
    }
  },
  computed:{
    hasCompanyLogo(){
      return this.initData.companyLogo
    },
    downloadStyle(){
      if(this.dialogType === '下载') return 'margin-top:20px;'
      return ''
    },
    title(){
      // 临时处理下，之后最好改为英文key
      const titleObj = {
        '预览': this.$t('product.previewQrcode'),
        '下载': this.$t('product.downloadQrcode'),
        '生成': this.$t('product.createQrcode'),
      }
      return titleObj[this.dialogType] || ''
      // return `${this.dialogType}二维码`
    },
    showCompanyName(){
      return this.checkList.indexOf('companyName') > -1
    },
    showLine(){
      let list = this.checkList.slice();
      const index = list.findIndex(item=>item !== 'companyName' && item !== 'companyLogo');
      return index > -1;
    },
    alreadyBind(){
      return this.qrcodeData.productId
    },
    defLogo(){
      return logoImg;
    },
    auths () {
      return this.initData?.auths
    },
    exportPermission () {
      return this.auths?.PRODUCT_CODE_EXPORT;
    },
    canProductCodeCreate() {
      return this.auths?.PRODUCT_CODE_CREATE
    },
    canProductCodeDownload() {
      return this.auths?.PRODUCT_CODE_DOWNLOAD
    },
    canProductCodeProduct() {
      return this.auths?.PRODUCT_CODE_PRODUCT
    },
    canGetProductDetail() {
      return (this.dialogType === '预览' && this.qrcodeData?.productId) || (this.dialogType === '下载' && this.qrcodeData[0]?.productId);
    },
  },
  props:{
    qrcodeData:[Object, Array],
    dialogType:{
      type:String,
      default:'预览'
    },
    initData:{
      type:Object,
      default:()=>{}
    },
    allowQrCodeImport: {
      type: Boolean,
      default: false
    },
    fromProduct:{
      type:Boolean,
      default:false
    }
  },
  watch:{
    createNum(val){
      if(val.indexOf('.') > -1){
        this.createNum = val.slice(0, -1);
        return
      }
      if(val < 0){
        this.createNum = '0';
      }else if(val > this.margin){
        this.createNum = String(this.margin);
      }
    },
    ['qrcodeData.qrcodeId'](val){
      if(this.dialogType === '预览' && this.isOpenMiniProgramCode){
        this.queryAppletQrCode(val)
      }
    }
  },
  mounted(){
    this.getProductFields();
    this.wechatGetAuthInfo()
  },
  methods:{
    // 取消关联成功
    unbindSuc(){
      setTimeout(()=>{
        this.$parent.search();
      }, 1000);
      
      this.visible = false;
    },
    // 取消关联
    unbindCode(){
      this.$refs.unbindDialog.open();
    },
    // 仅生成
    async createCode(callback){
      try{
        if(!this.createNum || this.createNum == 0) return this.$message.warning(this.$t('product.component.qrcodeDialog.tip2'));
        this.pending = true;
        let {status, message, data} = await this.checkNumExceedLimitAfterHandler(productQrcode.createQrCode({createNum:this.createNum}))
        this.pending = false;
        if(status === 0){
          if(callback) return callback(data);
          this.visible = false;
          this.$emit('createCode');
        }else{
          this.$message.error(message);
        }
      }catch(err){
        this.pending = false;
        console.error(err);
      }
    },
    // 下载二维码编号
    async downloadCode(ids){
      this.pending = true;
      try{
        let {status, message} = await productQrcode.exportExcel({ids:ids.join(',')});
        this.pending = false;
        this.$platform.alert(message);
        if(status === 0){
          this.visible = false;
          this.$emit('createCode');
          window.parent.showExportList();
          window.parent.exportPopoverToggle(true);
        }
      }catch(err){
        this.pending = false;
        console.error(err);
      }
    },
    // 下载二维码图片
    async downloadImg(data){
      this.pending = true;
      try{
        // let productExport=this.checkList.join(',');
        let productExport = `${this.checkList.join(',') },qrcodeId`;
        // if(this.hasCompanyLogo){
        //   productExport=productExport?productExport+',companyLogo':'companyLogo';
        // }
        const params = {
          productExport,
          ids:data.join(',')
        }
        let {status, message} = await productQrcode.exportImg(params);
        this.pending = false;
        this.$platform.alert(message);
        if(status === 0){
          this.visible = false;
          this.$emit('createCode');
          window.parent.showExportList();
          window.parent.exportPopoverToggle(true);
        }
      }catch(err){
        this.pending = false;
        console.error(err);
      }
    },
    createDownload(type){
      const ids = this.qrcodeData.map(item=>item.id);
      if(type === 'code') this.downloadCode(ids);
      else if(type === 'img') this.downloadImg(ids);
    },
    // 获取余量
    async getMargin(){
      try{
        let {data, status, message} = await productQrcode.getMargin();
        if(status === 0){
          this.margin = data;
        }else{
          this.$message.error(message);
        }
      }catch(err){
        console.error(err);
      }
    },
    // 获取名称
    getDisplayName(fieldName){
      if(fieldName === 'qrcodeId'){
        if(Array.isArray(this.qrcodeData)){
          return this.qrcodeData[0].qrcodeId
        }
        return this.qrcodeData.qrcodeId || this.$t('product.type.qrcodeId')
      }
      const item = this.fieldList.find(item=>item.fieldName === fieldName) || {};
      return item.displayName || '';
    },

    // 获取值
    getValue(fieldName, valueName) {
      if(!this.canGetProductDetail) return '';
      const valueMap = {
        [fieldName]: this.productFieldMap[valueName || fieldName],
        catalogId: this.productFieldMap.type,
        customer: this.productFieldMap.customerName || '',
      }
      const value = valueMap[fieldName] || ''

      if(fieldName === 'qualityInfo' && valueName) {
        // 质保信息
        return valueName.includes('Time') ? formatDate(value, 'date') : value;
      }
      
      const field = this.fieldList.find(item=>item.fieldName === fieldName) || {};
      return formatFormFieldItem(field, disposeFormItemViewTime(field, value)) || '';
    },

    itemClass(fieldName){
      if(fieldName !== 'qrcodeId' && fieldName !== 'companyName' && fieldName !== 'companyLogo'){
        return 'qrcode-item-center'
      }
      return 'qrcode-item-none'
      
    },
    // 勾选
    checkChange(val){
      if(val.length > 5) {
        this.$message.warning(this.$t('product.component.qrcodeDialog.tip3'))
        this.checkList.splice(5);
      } else {
        this.showLogo(!(val.indexOf('companyLogo') < 0));
        localStorage.setItem(`qrcode_check_items_${this.initData.domain}`, this.checkList.join(','));
      }
    },
    // 获取产品自定义字段
    async getProductFields(){
      try{
        let {status, data, message} = await productQrcode.getProductFields({isFromSetting:false});
        if(status === 0){
					const filterType = ['autograph', 'select', 'attachment', 'separator', 'info'];
					// 获取到被过滤的字段名称map
					this.filterFieldsNameMap = data.map(f => {
						return filterType.includes(f.formType) || f.setting?.isSubForm ? f.fieldName : '';
					}).filter(f => f && f.trim());

          data = data.filter(item => !this.filterFieldsNameMap.includes(item.fieldName));
          this.fieldList = this.fieldList.concat(data);
					this.allFieldsNameMap = this.fieldList.map(f => f.fieldName);
					
          if(!this.hasCompanyLogo){
            this.fieldList[0].disabled = true;
          }
          this.handleCheckList()
        }else{
          this.$message.error(message);
        }
      }catch(err){
        console.error(err);
      }
    },
    handleCheckList() {
      const checkFields = localStorage.getItem(`qrcode_check_items_${this.initData.domain}`);
      if(checkFields){
        // 兼容，历史选中的不能展示的类型需要被清除选中
        this.checkList = checkFields.split(',').filter(f => !this.filterFieldsNameMap.includes(f) && this.allFieldsNameMap.includes(f));
        const logoIndex = this.checkList.findIndex(item=>item === 'companyLogo');
        if(logoIndex > -1 && !this.hasCompanyLogo){
          this.checkList.splice(logoIndex, 1);
        }
      }
    },
    // 仅下载
    async download(){
      // this.activeName=='qrCode'
      if(this.activeName == 'qrCode'){
        this.pending = true;
        try{
          let productExport = `${this.checkList.join(',') },qrcodeId`;
          // if(this.hasCompanyLogo){
          //   productExport=productExport?productExport+',companyLogo':'companyLogo'
          // }
          const params = {
            productExport,
            qrcodeId:this.qrcodeData.qrcodeId
          }
          let data = await productQrcode.downloadOneQrcode(params);
          this.pending = false;
          let link = document.createElement('a');
        
          // base64
          let url = `data:image/jpeg;base64,${data}`;
          link.download = `${this.qrcodeData.qrcodeId}.png`;
          link.href = url;
          this.$refs.bridge.appendChild(link);
          link.click();
          setTimeout(() => {
            URL.revokeObjectURL(url);
            this.$refs.bridge.removeChild(link);
            this.visible = false;
          }, 150);

        
        }catch(err){
          this.pending = false;
          console.error(err);
        }
      }else if(this.activeName == 'miniProgramCode'){
        console.log('miniProgramCode')
        this.appletQrcodeDownloadOne()
      }
    },
  	open(){
      this.visible = true;
      if(!document.getElementById('qrCodeUrl')){
        return setTimeout(()=>{
          this.open();
        }, 200);
      }
      this.$nextTick(()=>{
        // 预览关联产品的二维码
        if(this.canGetProductDetail) {
          this.getProductFieldMap()
        }
        this.showQrcode();
        if(this.dialogType == '下载'){
          this.queryAppletQrCode(this.qrcodeData[0].qrcodeId)
        }
        // 开启了导入产品二维码的灰度需要再check一遍
        if (!this.isFirst && this.allowQrCodeImport) {
          this.handleCheckList()
        }
        this.isFirst = false
      })
    },
    
    // 显示二维码
    showQrcode(){
      document.getElementById('qrCodeUrl').innerHTML = '';
      let qrcodeId;
      if(Array.isArray(this.qrcodeData)) {
        qrcodeId = this.qrcodeData[0].qrcodeId;
      } else {
        qrcodeId = this.qrcodeData.qrcodeId;
      }
      // 初始化生成二维码
      new QRCode(this.$refs.qrCodeUrl, {
        text: `${window.location.origin}/qrcode/${this.initData.domain}?qrcodeId=${qrcodeId}`, // 需要转换为二维码的内容
        width: 120,
        height: 120,
        colorDark: '#000000',
        colorLight: '#ffffff',
        correctLevel: QRCode.CorrectLevel.H,
      });
      // 如果是点击生成二维码 需要查询余量
      if(this.dialogType === '生成'){
        this.getMargin();
      }
      // 判断是否展示公司logo
      const isShowLogo = !(this.checkList.indexOf('companyLogo') < 0);
      // 点击生成二维码的时候 第一次未勾选公司logo 展示默认logo
      const isShowDefaultLogo = this.dialogType === '生成';
      this.showLogo(isShowLogo, isShowDefaultLogo);
    },

    /**
     * @description: 显示logo
     * @param {Boolean} showLogo 是否展示logo
     * @param {Boolean} showDef 是否展示默认logo
     */    
    showLogo(showLogo = true, showDef = false){
      // 先清空logo img 再append
      const canvasChildNodes = this.$refs.qrCodeUrl?.childNodes || []
      canvasChildNodes && canvasChildNodes.forEach(childNode => {
        if(childNode.id === 'companyLogo') this.$refs.qrCodeUrl.removeChild(childNode)
      })

      if(!this.hasCompanyLogo){
        const index = this.checkList.findIndex(item => item === 'companyLogo');
        if(index > -1) this.checkList.splice(index, 1);
        localStorage.setItem(`qrcode_check_items_${this.initData.domain}`, this.checkList.join(','));
      }
      
      if(!showLogo && !showDef) return;

      this.$nextTick(()=>{
        const img = document.createElement('img');
        img.src = !showLogo && showDef ? this.defLogo : this.initData.companyLogo;
        img.setAttribute('id', 'companyLogo');
        img.style.position = 'absolute';
        img.style.top = 'calc(50% - 18px)';
        img.style.left = 'calc(50% - 18px)';
        img.style.width = '36px';
        img.style.height = '36px';
        img.style.border = '2px solid #fff';
        img.style.borderRadius = '4px';
        img.style.backgroundColor = '#fff';
        this.$refs.qrCodeUrl.appendChild(img);
      })
    },
    // 获取授权信息-小程序
    async wechatGetAuthInfo(){
      const {data} = await wechatGetAuthInfo()
      if(data && data.status == 1){
        this.isOpenMiniProgramCode = !!data.data.attribute.appletQrcodeStatus
        this.miniProgramDefaultImg = data.data.attribute.qrCodeOssUrl
      }
    },
    // 查询小程序二维码
    async queryAppletQrCode(qrcodeId){
      const params = {
        qrcodeId
      }
      const {result} = await queryAppletQrCode(params)
      if(result){
        this.miniProgramImg = result.ossUrl
        this.appletCodeId = result.id
      }
    },
    // 下载单张小程序码-预览
    async appletQrcodeDownloadOne(){
      this.pending = true;
      try{
        let productExport = `${this.checkList.join(',') },qrcodeId`;
        const params = {
          productExport,
          qrcodeId:this.qrcodeData.qrcodeId,
          appletCodeId:this.appletCodeId
        }
        let data = await appletQrcodeDownloadOne(params);
        this.pending = false;
        let link = document.createElement('a');
        
        // base64
        let url = `data:image/jpeg;base64,${data}`;
        link.download = `${this.$t('product.component.qrcodeDialog.text4')}-${this.qrcodeData.qrcodeId}.png`;
        link.href = url;
        this.$refs.bridge.appendChild(link);
        link.click();
        setTimeout(() => {
          URL.revokeObjectURL(url);
          this.$refs.bridge.removeChild(link);
          this.visible = false;
        }, 150);

        
      }catch(err){
        this.pending = false;
        console.error(err);
      }
    },


    // 根据productID 获取 产品详情
    getProductFieldMap() {
      const payload = {
        id:  Array.isArray(this.qrcodeData) ? this.qrcodeData[0]?.productId : this.qrcodeData.productId
      }
      getProductDetail(payload)
        .then(res => {
          if(res) {
            this.productFieldMap = Object.assign({}, res, res.attribute)
          }
        })
        .catch(e => console.error('getProductFieldMap error', e));
    },
  },
  components:{
    [UnbindDialog.name]:UnbindDialog
  }
}
</script>

<style lang="scss" scoped>
.dialog-container {
  &.create-qrcode {
    padding-left: 30px;
  }
  .content {
    padding: 10px 20px;
  }
}
::v-deep .el-checkbox{
  margin-bottom: 4px;
}
::v-deep .el-checkbox__label{
  color: #606266 !important;
}
::v-deep .el-dialog{
  border-radius: 8px;
}
::v-deep .el-dialog__header{
  background-color: $bg-color-l2;
  padding-top: 10px;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  font-weight: bold;

  .el-dialog__headerbtn{
    top: 0;
  }
}
::v-deep .el-dialog__body{
  padding: 0;
}
::v-deep .el-dialog__footer{
  border-top: 1px solid $color-border-l2;
  padding-bottom: 10px;
}
#qrCodeUrl{
  position: relative;
}
.download-top{
  padding-left: 20px;
  background-color: #FFFBE4;
  color: #F2CD79;
  width: 100%;
  height: 30px;
  line-height: 30px;
}
.qrcode-wrapper{
  display: flex;
  justify-content: space-between;
  padding: 12px;
  background-color: $bg-color-l1;
  border-radius: 4px;

  .qrcode-left{
    width: 350px;

    .qrcode-tip{
      font-size: 12px;
      margin-bottom: 10px;
    }

    .qrcode-content{
      // border: 1px solid $color-border-l1;
      padding-bottom: 10px;
      min-height: 290px;
      background-color: #fff;
      padding-top: 2px;

      .qrcode-company{
        text-align: center;
        margin: 20px;
      }
      .qrcode-item{
        text-align: center;
        margin: 5px 0;
        font-size: 12px;
        .miniProgramCodeImg{
          width: 120px;
          height: 120px;
        }
      }
      .com-item{
        margin-top: 12px;
      }
      .qrcode-item-center{
        text-align: left;
        margin-left: 20px;
        margin-top: 5px;
      }
      .qrcode-item-none{
        display: none;
      }
      .qrcode-item-line{
        height: 0;
        border-bottom: 1px dashed $color-border-l1;
      }
      .qrcode-item-quality{
        text-align: left;
        margin-top: 5px;
      }
      .code-container{
        border:1px solid $color-border-l1;
        border-radius: 10px;
        padding: 5px;
        width: 130px;
        height: 130px;
        margin: 10px auto;

        div{
          height: 110px;
        }
      }
    }
  }
  .qrcode-right{
    width: 34%;
    max-height: 316px;

    .field-list{
      height: calc(100% - 30px);
      overflow-y: auto;
      display: flex;
      flex-direction: column;
    }
  }
}
.qrcode-bottom{
  margin-top: 20px;

  .qrcode-create-num{
    display: flex;
    align-items: baseline;

    ::v-deep .el-input{
      width: 100px;
      margin-right: 10px;
    }
    .qrcode-margin{
      color: $color-warning;
    }
  }
  .qrcode-text{
    margin-top: 15px;
    span{
      color: $color-warning;
    }
  }
}
.stepper{
  position: absolute;
  top: 104px;
  left: 15px;
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  align-items: center;

  div{
    width: 26px;
    height: 26px;
    font-size: 16px;
    color: #fff;
    background-color: $color-primary;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
  }
  p{
    width: 0;
    border-left: 2px solid $color-border-l1;
    margin-bottom: 0;
    height: 360px;
  }
}
</style>